import { createApp } from 'vue'
import { createPinia } from 'pinia'
import 'vant/lib/index.css';
import App from './App.vue'
import router from './router'
import persistedState from 'pinia-plugin-persistedstate'

//移动端适配
import 'lib-flexible';
// 计算并设置根元素的字体大小
function setRem() {
    const rem = document.documentElement.clientWidth / 10;
    document.documentElement.style.fontSize = rem + 'px';
}

// 初始化时调用一次
setRem();

// 监听窗口大小变化时重新计算
window.addEventListener('resize', setRem);

const app = createApp(App)
const pinia = createPinia()
pinia.use(persistedState)

app.use(pinia)

app.use(router)
app.mount('#app')

